<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<h:outputStylesheet library="css" name="estilo.css" />
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Sistema de Biblioteca</title>
</h:head>
<h:body>
	<h:form>
		<h1>Lista de Editoras</h1>
		
		<p:messages />
		
		<p:dataTable value="#{editoraController.editoras}"
			var="editora">
		
			<p:column headerText="Código">
				<h:outputText value="#{editora.codigo}"/>
			</p:column>

			<p:column headerText="Nome">
				<h:outputText value="#{editora.nome}"/>
			</p:column>

			<p:column headerText="Ações">
				<h:commandLink value="Alterar"
					action="/cadastro/editora/alterar.xhtml">
					<f:setPropertyActionListener 
						target="#{editoraController.editora}" 
						value="#{editora}" />
				</h:commandLink>
				
				<p:spacer width="15" />
				
				<h:commandLink value="Excluir"
					action="#{editoraController.excluir}">
					<f:setPropertyActionListener 
						target="#{editoraController.editora}" 
						value="#{editora}" />
				</h:commandLink>				
			</p:column>
		
		</p:dataTable>

		<h:commandButton value="Incluir" 
			action="/cadastro/editora/incluir.xhtml" />
		<h:commandButton value="Voltar" action="/principal.xhtml" />
	</h:form>
</h:body>
</html>